/*
 * File:   Example3.java
 * Author: Oleg S. Estekhin
 */
package dht.emulator.example;

import java.util.ArrayList;
import java.util.List;

import dht.emulator.DefaultNode;
import dht.emulator.Identifier;
import dht.emulator.Node;
import dht.emulator.filters.MessageCounter;

public class Example5
{

    public static void main(String[] args)
    {
        int value = 0;
        List<Node> nodes = new ArrayList<Node>();
        int size = 20;
        Node previous = null;
        for (int i = 0; i < size; i++)
        {
            List<Node> knownNodes = new ArrayList<Node>();
            if (previous != null)
            {
                knownNodes.add(previous);
            }

            Node node = new MessageCounter(new DefaultNode(Identifier.randomIdentifier(4), knownNodes));
            node.init();
            node.putValue(Identifier.randomIdentifier(4), "Value" + value);
            value++;

            nodes.add(node);
            previous = node;
            // System.out.println(i+" "+ node);
        }
/*        for (int i=size-1; i>0; i--)
        {
            nodes.get(0).getQuality(nodes.get(i));
        }*/
        for (Node node : nodes)
        {
            System.out.println(node);
        }
    }

}